//
// Created by zhehua on 2024/9/12.
//

#ifndef ARMCORE_CHESS_H
#define ARMCORE_CHESS_H


#include <iostream>
#include <map>
#include <string>
#include <Arduino.h>


// 定义棋子类型和颜色
//enum PieceType { King, Queen, Rook, Bishop, Knight, Pawn, Empty };
// 定义棋子类型
typedef enum {
    PAWN,
    KNIGHT,
    BISHOP,
    ROOK,
    QUEEN,
    KING,
    Empty
} PieceType;


enum PieceColor { White, Black, None };

// 定义棋子结构
struct Piece {
    PieceType type;
    PieceColor color;

    Piece() : type(Empty), color(None) {}
    Piece(PieceType t, PieceColor c) : type(t), color(c) {}
};

// 初始化棋盘状态
std::map<std::string, Piece> initializeBoard();

// 打印棋盘状态
void printBoard(const std::map<std::string, Piece>& board);

void moveChessPiece(String start, String end);




class ChessUtils {
public:
    std::string convertToChessPosition(int row, int col);
    void updateBoard(std::string& board, const std::string& move);
    std::string generateFENFromUCI(const std::string& initialFEN, const std::string& moves);
};


#endif //ARMCORE_CHESS_H
